import copy


class ProtoType:
    def clone(self):
        pass


class ConcretePrototype(ProtoType):
    def __init__(self, some_attr):
        self.some_attr = some_attr

    def clone(self):
        # 返回当前对象的一个浅拷贝
        return copy.copy(self)

    def deep_clone(self):
        # 返回当前对象的一个深拷贝
        return copy.deepcopy(self)


# 客户端使用
prototype_instance = ConcretePrototype("Attribute")
cloned_instance = prototype_instance.clone()
deep_cloned_instance = prototype_instance.deep_clone()

print(prototype_instance.some_attr)  # 输出：Attribute
print(cloned_instance.some_attr)  # 输出：Attribute
print(deep_cloned_instance.some_attr)  # 输出：Attribute
print(prototype_instance is cloned_instance)  # 输出：False
print(prototype_instance is deep_cloned_instance)  # 输出：False
print(id(prototype_instance), id(cloned_instance), id(deep_cloned_instance))
print(id(prototype_instance.some_attr), id(cloned_instance.some_attr), id(deep_cloned_instance.some_attr))

'''
Attribute
Attribute
Attribute
False
False
1858619736016 1858619735392 1858619735200
1858331494064 1858331494064 1858331494064
'''